package com.mz.ozy.activity.c2c;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.mz.ozy.R;
import com.mz.ozy.base.BaseActivity;
import com.mz.ozy.bean.BalanceDetailBean;
import com.mz.ozy.bean.BankListFBean;
import com.mz.ozy.bean.ReceiveAccountBean;
import com.mz.ozy.mvp.presenter.ReceiveAccountPresenter;
import com.mz.ozy.mvp.view.ReceiveAccountContract;
import com.mz.ozy.utils.ToastUtils;

import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class CurAccountActivity extends BaseActivity<ReceiveAccountContract.View, ReceiveAccountPresenter> implements ReceiveAccountContract.View {

    @BindView(R.id.et_real_name)
    TextView etRealName;
    @BindView(R.id.et_bankcard_num)
    TextView etBankcardNum;
    @BindView(R.id.et_card_bank)
    TextView etCardBank;
    @BindView(R.id.et_alipay_account)
    TextView etAlipayAccount;

    @BindView(R.id.tv_account_tipmsg)
    TextView tvAccountTipmsg;
    @BindView(R.id.tv_type)
    TextView tvType;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cur_account);
        ButterKnife.bind(this);
        initTitle();
        if (getIntent().getIntExtra("type", 0) == 1) {
            tvType.setText("微信账号");
            tvCenterTitle.setText("绑定微信");
        } else {
            tvType.setText("支付宝账号");
            tvCenterTitle.setText("绑定支付宝");
        }
    }

    public static void go(Context context, int type) {
        Intent intent = new Intent(context, CurAccountActivity.class);
        intent.putExtra("type", type);
        context.startActivity(intent);
    }


    @Override
    public void saveAccountSuccess(BalanceDetailBean bean) {
        ToastUtils.showToast("保存成功");
        finish();
    }

    @Override
    public void queryAccountSuccess(ReceiveAccountBean bean) {

    }

    @Override
    public void onGetBankSuccess(BankListFBean o) {

    }

    @Override
    public void bindInfo(JSONObject bean) {

    }

    @OnClick(R.id.btn_sure)
    public void onViewClicked() {
        String rele = etRealName.getText().toString();
        String account = etAlipayAccount.getText().toString();
        if (TextUtils.isEmpty(rele)) {
            ToastUtils.showToast("请输入真实姓名");
            return;
        }
        if (TextUtils.isEmpty(account)) {
            ToastUtils.showToast("请输入账号");
            return;
        }
//        mPresenter.queryAccount();
    }
}
